package com.kob.mysql.result;

import java.io.Serializable;


public final class R<T> implements Serializable {
    static final long serialVersionUID = -1L;
    private int code;
    private String msg;

    public R() {
    }

    public R(int code) {
        this.code = code;
        this.msg = "";
    }

    public R(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
    public static R Success( ) {
        return new R(ResultCodeEnum.SUCCESS.getCode(), ResultCodeEnum.SUCCESS.getMessage());
    }
    public static R Success( String msg) {
        return new R(ResultCodeEnum.SUCCESS.getCode(), msg);
    }

    public static R Failed(String msg) {
        return new R(ResultCodeEnum.Internal_Server_Error.getCode(), msg);
    }
    public static R Failed(int code,String msg) {
        return new R(code,msg);
    }

    public static R Failed() {
        return Failed("Failed");
    }


}
